// 上传文件的路由

import koaRouter from "koa-router"; // 引入路由
import UploadController from "../controller/UploadController";
import bodyParser from 'koa-bodyparser';

const upload = new koaRouter();

// 调用此中间件可以解析post的数据
upload.use(bodyParser());

// get访问/upload
upload.get('/', UploadController.index);

// post访问/upload
upload.post('/', UploadController.postIndex);

// post访问/upload/uploadfile上传单个文件
upload.post('/uploadfile', UploadController.postUploadFile);

// post访问/upload/uploadfiles上传多个文件
upload.post('/uploadfiles', UploadController.postUploadFiles);

export default upload;
